﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace ManticLabs.TourIS
{
    public partial class ListClient : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //a
        }

        protected void grdListClient_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.ToLower() == "EditRow".ToLower())
            {
                //Response.Write("editing called");
                lblMessage.Text = "editing " + grdListClient.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString() + ", " + grdListClient.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[1].ToString();
                hMode.Value = General.FormModes.ModeEdit.ToString();
                hID1.Value = grdListClient.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString();
                hID2.Value = grdListClient.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[1].ToString();
                Server.Transfer("CreateClient.aspx", true);
            }
            else if (e.CommandName.ToLower() == "DeleteRow".ToLower())
            {
                lblMessage.Text = "deleting " + grdListClient.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString() + ", " + grdListClient.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[1].ToString();
                //Response.Write("delete called");
            }
            else
            {
                lblMessage.Text = "Unknow action (" + e.CommandName + ") requested. Please contact administrator";
                lblMessage.ForeColor = Color.Red;
            }
        }

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            grdListClient.DataBind();
        }
    }
}